import { defineStore } from 'pinia';
import { store } from '../index';
export const useAppStore = defineStore('app', {
  state: () => {
    return {
      userinfo: null,
      routes: null,
      clientSettings: null,
    };
  },
  getters: {
    getUserinfo() {
      return this.userinfo;
    },
    getRoutes() {
      return this.routes;
    },
    getClientSettings() {
      return this.clientSettings;
    },
  },
  actions: {
    setUserinfo(userinfo) {
      this.userinfo = userinfo;
    },
    setRoutes(routes) {
      this.routes = routes;
    },
    setClientSettings(clientSettings) {
      this.clientSettings = clientSettings;
    },
    delState() {
      this.setUserinfo(null);
      this.setRoutes(null);
      this.setClientSettings(null);
    },
  },
});

export const useAppStoreWithOut = () => {
  return useAppStore(store);
};
